package abraham;

import java.io.IOException;

public class Main {
	
	public static void main(String[] args){
		AdaptiveHuffmanTree ahf=new AdaptiveHuffmanTree();
		BitsWriter bw=new BitsWriter();
		try {
			bw.OpenFile("output.bin");
			
			bw.AppendBits(ahf.EatChar('A'));
			bw.AppendBits(ahf.EatChar('A'));
			bw.AppendBits(ahf.EatChar('D'));
			bw.AppendBits(ahf.EatChar('C'));
			bw.AppendBits(ahf.EatChar('C'));
			bw.AppendBits(ahf.EatChar('D'));
			bw.AppendBits(ahf.EatChar('D'));
			bw.AppendBits(ahf.GetEndingCode());
			
			bw.Close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//ahf.Display();
		//Debug.println("\n\n\n");
		//Debug.println(ahf.EatChar('A'));
//		ahf.Display();
//		Debug.println("\n\n\n");
//		Debug.println(ahf.EatChar('D'));
//		ahf.Display();
//		Debug.println("\n\n\n");
//		Debug.println(ahf.EatChar('C'));
//		ahf.Display();
//		Debug.println("\n\n\n");
//		Debug.println(ahf.EatChar('C'));
//		ahf.Display();
//		Debug.println("\n\n\n");
//		Debug.println(ahf.EatChar('D'));
//		ahf.Display();
//		Debug.println("\n\n\n");
//		Debug.println(ahf.EatChar('D'));
		//System.out.print(AdaptiveHuffmanTree.CharToBinary('z'));
	}
	
}
class Debug{
	public static void print(String msg){
		System.out.print(msg);
	}
	public static void println(String msg){
		System.out.println(msg);
	}
}